home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Chat & Communication
/
Digsby build 37
/
digsby_setup.exe
/
lib
/
common
/
accountbase.pyo
(
.txt
)
< prev
next >
Wrap
Python Compiled Bytecode
|
2008-10-13
|
4KB
|
93 lines
# Source Generated with Decompyle++
# File: in.pyo (Python 2.5)
import cPickle
from util.observe import Observable
from common import HashedAccount
from common.actions import ActionMeta
from common import profile
from util import dictdiff
class AccountBase(Observable, HashedAccount):
max_error_tolerance = 3
__metaclass__ = ActionMeta
_ids = []
def next_id(cls):
i = len(cls._ids) - 1
for i, j in enumerate(sorted(cls._ids)):
if i != j:
break
continue
else:
i += 1
cls._ids.insert(i, i)
return i
next_id = classmethod(next_id)
def __init__(self, name, password, **options):
Observable.__init__(self)
self.name = name
self.password = password
self.id = None if 'id' in options else self.next_id()
self.error_count = 0
def popupids(self):
return set((self,))
popupids = property(popupids)
def username(self):
return self.name
username = property(username)
def protocol_class(self):
proto_init = proto_init
import common.protocolmeta
return proto_init(self.protocol)
def _repr(self):
return '<%s %s (%s) %s, %r>' % (self.__class__.__name__, self.name, getattr(self, 'protocol', None), getattr(self, 'state', None), getattr(self, 'offline_reason', None))
_repr = staticmethod(_repr)
def __repr__(self):
return self._repr(self)
def default(self, key):
return self.protocol_info()['defaults'][key]
def get_options(self):
opts = self._get_options()
d = self.protocol_info()['defaults']
return dictdiff(d, opts)
def _decryptedpw(self):
return profile.plain_pw(self.password)
class FromNetMixin(object):
def __init__(self, *a, **k):
pass
def from_net(cls, info, **extra):
proto_init = proto_init
import common.protocolmeta
Class = proto_init(info.protocol)
cls._ids.insert(info.id, info.id)
extra.update(**cPickle.loads(info.data))
return Class(name = info.username, password = info.password, id = info.id, **extra)
from_net = classmethod(from_net)